home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE22
/
EX1.C
next >
Wrap
C/C++ Source or Header
|
1995-05-27
|
2KB
|
51 lines
#include <genstub.c>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
{
TCHAR szBuffer[64];
TCHAR szTemp[16];
TCHAR szFrench[] = { 0x41, 0xee, 0x6e, 0xe9, 0 };
HDC hDC = GetDC( hWnd );
HFONT hOldFont;
// Copy into temporary buffer.
lstrcpy( szTemp, szFrench );
TextOut( hDC, 0, 0, szBuffer, wsprintf( szBuffer,
"Original String: %s", szTemp ) );
TextOut( hDC, 0, 20, szBuffer, wsprintf( szBuffer,
"After CharUpper: %s", CharUpper( szTemp ) ) );
TextOut( hDC, 0, 40, szBuffer, wsprintf( szBuffer,
"After CharLower: %s", CharLower( szTemp ) ) );
// Select an OEM font to do OEM display.
hOldFont = SelectObject( hDC,
GetStockObject( OEM_FIXED_FONT ) );
CharToOem( szTemp, szTemp ); // in-place char->OEM conversion
TextOut( hDC, 0, 60, szBuffer, wsprintf( szBuffer,
"After CharToOem: %s", szTemp));
// Return DC to original settings.
DeleteObject( SelectObject( hDC, hOldFont ) );
ReleaseDC( hWnd, hDC );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return (NULL);
}